import NProgress from "nprogress";
import {getToken} from "@/utils/auth";
import {constantRouterMap, doctorRouterMap, systemRouterMap} from "@/router/index";
import router from "@/router/index";
import {getCookie} from "@/utils/cookies";
import user from "@/store/modules/user";
import store from "@/store";

// export function getPermission() {
//   //判断当前用户是否是管理员,如果是管理员则添加管理员路由
//   if (getCookie('username') === 'admin' ) {
//     let array = constantRouterMap.concat(systemRouterMap);
//     router.options.routes = array;
//     router.onReady(() => {
//       router.addRoutes(array)
//     });
//     store.dispatch('SetRoutes', getCookie('username')).then(()=>{
//       console.log('vuex添加路由成功')
//     })
//   } else {
//     let array = constantRouterMap.concat(doctorRouterMap);
//     router.options.routes = array;
//     router.addRoutes(array)
//     store.dispatch('SetRoutes', getCookie('username')).then(()=>{
//       console.log('vuex添加路由成功')
//     })
//   }
//
// }
